'use strict';

module.exports = app => {
  const {TEXT, STRING, INTEGER, DATE } = app.Sequelize;

  const Secret = app.model.define('secret', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    user_id: {
      type: INTEGER(64),
      allowNull: false,
      comment: '用户id',
    },
    username: {
      type: STRING(255),
      allowNull: false,
      unique: true,
      comment: '用户名',
    },
    password: {
      type: TEXT,
      allowNull: false,
      comment: '密码',
    },
    scret_protection: {
      type: STRING(255),
      allowNull: false,
      comment: '密保',
    },
    created_at: DATE,
    updated_at: DATE,
  }, {
    sequelize:app.Sequelize,
    modelName: 'secret',
    tableName: 'secret',
    freezeTableName: true
  });

  return Secret;
};